package com.company.tanxin;

import java.util.List;

public class BoxMinOperation {
    public int[] minOperations(String boxes) {
        return doOperate(boxes.toCharArray());
    }


    //
    private int[] doOperate(char[] boxes){

        int[] result = new int[boxes.length];
        for (int i = 0; i < boxes.length; i++) {
            int count = 0;
            for (int index = 0; index < boxes.length; index++) {
                if (boxes[index] == '0') {
                    continue;
                }
                count+=Math.abs(index-i);
            }
            result[i] = count;
        }
        return result;
    }
}
